import { City } from '../../City';
import { Zone } from './Zone';
import { Building } from '../Building';
import { Job } from '../modules/Job';

/**
 * 商业区
 */
export class CommercialZone extends Zone {

    job = new Job(this);

    constructor() {
        super();
        this.name = generateBusinessName();
        this.type = Building.type.commercial;
    }

    simulate(city: City) {
        super.simulate(city);
        this.job.simulate();
    }

    dispose() {
        this.job.dispose();
        super.dispose();
    }

    toHTML() {
        let html = super.toHTML();
        html += this.job.toHTML();
        return html;
    }
}

// Arrays of words for generating business names
const prefixes = ['Prime', 'Elite', 'Global', 'Exquisite', 'Vibrant', 'Luxury', 'Innovative', 'Sleek', 'Premium', 'Dynamic'];
const suffixes = ['Commerce', 'Trade', 'Marketplace', 'Ventures', 'Enterprises', 'Retail', 'Group', 'Emporium', 'Boutique', 'Mall'];
const businessSuffixes = ['LLC', 'Inc.', 'Co.', 'Corp.', 'Ltd.'];

// Function to generate a random commercial business name
function generateBusinessName() {
    const prefix = prefixes[Math.floor(Math.random() * prefixes.length)];
    const suffix = suffixes[Math.floor(Math.random() * suffixes.length)];
    const businessSuffix = businessSuffixes[Math.floor(Math.random() * businessSuffixes.length)];

    return prefix + ' ' + suffix + ' ' + businessSuffix;
}